package com.example.stringbufferlogger.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.stringbufferlogger.entity.FileConfig;
import com.example.stringbufferlogger.mapper.FileConfigMapper;
import com.example.stringbufferlogger.service.FileConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FileConfigServiceImpl extends ServiceImpl<FileConfigMapper, FileConfig> implements FileConfigService {
    @Autowired
    private FileConfigMapper fileConfigMapper; // 确保这里已注入
    @Override
    public List<FileConfig> getAllFileConfigs() {
        return list();
    }

    @Override
    public List<FileConfig> getFileConfigsByInterfaceAdrs(String interfaceAdrs) {
        QueryWrapper<FileConfig> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("interface_adrs", interfaceAdrs);
        return list(queryWrapper);
    }

    @Override
    public String getFileTypeByReqID(String requestId) {
        return baseMapper.selectFileTypeByRequestId(requestId);
    }
}
